<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "article".
 *
 * @property integer $art_id
 * @property string $title
 * @property string $keywords
 * @property string $description
 * @property string $content
 * @property integer $create_id
 * @property integer $create_time
 * @property integer $comment_time
 * @property integer $comment_user_id
 * @property integer $comment_num
 * @property integer $cat_id
 * @property integer $sort
 * @property string $thumb
 */
class Article extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'article';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'content', 'create_id', 'cat_id'], 'required'],
            [['content'], 'string'],
            [['create_id', 'create_time', 'comment_time', 'comment_user_id', 'comment_num', 'cat_id', 'sort'], 'integer'],
            [['title'], 'string', 'max' => 120],
            [['keywords', 'description', 'thumb'], 'string', 'max' => 255],
            ['sort', 'default', 'value'=>100],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'art_id' => '文章ID',
            'title' => '文章标题',
            'keywords' => '三要素-关键词',
            'description' => '三要素-描述',
            'content' => '文章内容',
            'create_id' => '创建用户ID',
            'create_time' => '创建时间',
            'comment_time' => '最后评论时间',
            'comment_user_id' => '最后评论用户Id',
            'comment_num' => '评论数',
            'cat_id' => '分类ID',
            'sort' => '排序',
            'thumb' => '缩略图',
        ];
    }
}
